package close.util;

public class AngleMath {
	
	private AngleMath(){}
	
	public static float angleDifference(float angle1, float angle2){
		float dAng = angle1 - angle2;
		if (Math.abs(dAng) < 180){
			return dAng;
		} else if (dAng < 0){
			while(dAng < -180){
				dAng += 360;
			}
			return dAng;
		} else {
			while(dAng > 180){
				dAng -= 360;
			}
			return dAng;
		}
	}

}
